/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author user
 */


import java.applet.*;

import java.awt.*;

import java.awt.event.*;

public class Testing extends Applet
{
  TextField txt1 = new TextField(10);
  Button btn1 = new Button("Button1");
  Button btn2 = new Button("Button2");
  Button btn3 = new Button("Button3");
  Button btn4 = new Button("Button4");

  public void init()
  {
   add(txt1);
   add(btn1);
   add(btn2);
   add(btn3);
   add(btn4);

   /* Создаём анонимный внутренний класс для каждого ActionListener */

   btn1.addActionListener(new ActionListener()
   {
    public void actionPerformed(ActionEvent e)
    {
     txt1.setText("Button1 clicked");
    }
   });

   btn2.addActionListener(new ActionListener()
   {
     public void actionPerformed(ActionEvent e)
     {
       txt1.setText("Button2 clicked");
     }
   });

   btn3.addActionListener(new ActionListener()
   {
     public void actionPerformed(ActionEvent e)
     {
       txt1.setText("Button3 clicked");
     }
   });


btn4.addActionListener(new ActionListener()

{

public void actionPerformed(ActionEvent e)

{

txt1.setText("Button4 clicked");
     }

   });

  }

}
